
var Deck = Class.extend({
	init: function(){
		this.cardList = [];
		this.create();
		this.shuffle();
	},
	create: function(){
		for (var i = 1; i<14; i++) {
			for (var j = 0; j<4; j++) {
				this.cardList.push(c = new Card(i,j));
			}
		}
		//Jokers
		//Color
		this.cardList.push(c = new Card(99,5));
		//Black
		this.cardList.push(c = new Card(99,6));
	},
	shuffle: function(){
		for (var i = 0; i < this.cardList.length; i++) {
			var place = Math.floor(Math.random()*(54));
		    var temp = this.cardList[i];
		    this.cardList[i] = this.cardList[place];
		    this.cardList[place] = temp;
		}
	},
	randomCard: function(){
		//console.log("Card List Length : " + this.cardList.length);
		var place = Math.floor(Math.random()*this.cardList.length);
		//console.log("Index picked : " + place);
		var temp = this.cardList[place];
		this.cardList.splice(place,1);
		return temp;
	}
});

/*
function Deck() {
	this.cardList = [];
	this.create();
	this.shuffle();
}

Deck.prototype.create = function() {
	for (var i = 1; i<14; i++) {
		for (var j = 0; j<4; j++) {
			this.cardList.push(c = new Card(i,j));
		}
	}
	//Jokers
	//Color
	this.cardList.push(c = new Card(99,5));
	//Black
	this.cardList.push(c = new Card(99,6));
	
}

Deck.prototype.shuffle = function() {
    for (var i = 0; i < this.cardList.length; i++) {
		var place = Math.floor(Math.random()*(54));
	    var temp = this.cardList[i];
	    this.cardList[i] = this.cardList[place];
	    this.cardList[place] = temp;
		
	}
}

Deck.prototype.randomCard = function() {
	//console.log("Card List Length : " + this.cardList.length);
	var place = Math.floor(Math.random()*this.cardList.length);
	//console.log("Index picked : " + place);
	var temp = this.cardList[place];
	this.cardList.splice(place,1);
	return temp;
}
*/